#ifndef SIPSUBB2BSESSION_HPP__
#define SIPSUBB2BSESSION_HPP__

#include "SipGDServiceConfigure.hpp"
#include "SipB2BSession.hpp"
#include "SipSubscribeSession2.hpp"


namespace wtsip{

class WTGD_SIPSRV_PUBLIC CSipSubB2bSession: 
    public CSipB2BSession,
    public CSipSubscribe2Handle
{
public:

    CSipSubB2bSession(CSipGDService& srv, CSipSubscribeSession2& caller, CSipSubscribeSession2& callee);

    virtual ~CSipSubB2bSession(void);

    virtual bool startCaller(SipMessage& calleeReq);

protected:

    bool insertMap(const resip::Data& callerId, const resip::Data& calleeId);

    const resip::Data& getCalleeId(const resip::Data& callerId);

    /////////////////////  subscribe handle  ///////////////////

    virtual bool onSubscribe(SipMessage& msg, CSipSubscribeSession2& subs);

    virtual bool onNotify(SipMessage& msg, CSipSubscribeSession2& subs);

    virtual bool onUnsubscribe(SipMessage& msg, CSipSubscribeSession2& subs);

    ////////////////////   Session handle //////////////////////

    virtual bool onSuccess(SipMessage& msg, CSipSessionBase& sb);

    virtual bool onFailed(SipMessage& msg, CSipSessionBase& sb);

    virtual bool onTrying(SipMessage& msg, CSipSessionBase& sb);

    virtual bool onDestroy(CSipSessionBase& sb);

private:

    std::map<resip::Data, resip::Data> m_transMap;
};



}//namespace


#endif

